package com.sqstudio.exercise.chapter4{
	
	import flash.events.Event;
	
	import org.papervision3d.materials.BitmapFileMaterial;
	import org.papervision3d.materials.WireframeMaterial;
	import org.papervision3d.materials.special.CompositeMaterial;
	import org.papervision3d.objects.primitives.Plane;
	import org.papervision3d.view.BasicView;

	[SWF(width="800",height="600")]
	
	
	/**
	 *混合材质 
	 * @author Nestor
	 * 
	 */	
	public class CompositeMaterialExample extends BasicView
	{
		public function CompositeMaterialExample(viewportWidth:Number=800, viewportHeight:Number=600, scaleToStage:Boolean=true, interactive:Boolean=false, cameraType:String="Target")
		{
			super(viewportWidth, viewportHeight, scaleToStage, interactive, cameraType);
			stage.frameRate = 40;
			init();
			this.startRendering();
		}
		
		private function init():void{
			var bm:BitmapFileMaterial = new BitmapFileMaterial("assets/2.png");
			var wf:WireframeMaterial = new WireframeMaterial(0xff0000,0.5,1);
			var cm:CompositeMaterial = new CompositeMaterial();
			cm.addMaterial(bm);
			cm.addMaterial(wf);
			
			var plane:Plane = new Plane(cm,500,300,5,4);
			scene.addChild(plane);
			plane.localRotationY = 45;
		}
		
		override protected function onRenderTick(event:Event=null):void
		{
			super.onRenderTick(event);
		}
	}
}